#import <Foundation/Foundation.h>


@interface FWPreferences : NSObject
{
    NSDictionary* preferences;
    NSString* filename;
}

@property (readonly, retain) NSDictionary* preferences;
@property (readonly, retain) NSString* filename;


+ (FWPreferences*)preferencesWithDictionary:(NSDictionary*)pref;
+ (FWPreferences*)preferencesWithFile:(NSString*)file;

- (id)initWithPreferences:(NSDictionary*)pref;
- (id)initWithFile:(NSString*)file;
- (void)dealloc;

+ (NSString*)stringValue:(NSString*)name withDefault:(NSString*)def preferences:(NSDictionary*)dict;
+ (BOOL)boolValue:(NSString*)name withDefault:(BOOL)def preferences:(NSDictionary*)dict;
+ (int)intValue:(NSString*)name withDefault:(int)def preferences:(NSDictionary*)dict;
+ (NSArray*)arrayValue:(NSString*)name withDefault:(NSArray*)def preferences:(NSDictionary*)dict;

- (NSArray*)arrayValue:(NSString*)name withDefault:(NSArray*)def;
- (NSString*)stringValue:(NSString*)name withDefault:(NSString*)def;
- (BOOL)boolValue:(NSString*)name withDefault:(BOOL)def;
- (int)intValue:(NSString*)name withDefault:(int)def;

- (void)persist;
    
@end
